\(\int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx\) [168]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [F(-2)]
   Mupad [F(-1)]

Optimal result

Integrand size = 25, antiderivative size = 91 \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\frac {2 c \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a+a \sec (e+f x)}}\right )}{\sqrt {a} f}-\frac {\sqrt {2} (c-d) \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {2} \sqrt {a+a \sec (e+f x)}}\right )}{\sqrt {a} f} \]

[Out]

2*c*arctan(a^(1/2)*tan(f*x+e)/(a+a*sec(f*x+e))^(1/2))/f/a^(1/2)-(c-d)*arctan(1/2*a^(1/2)*tan(f*x+e)*2^(1/2)/(a
+a*sec(f*x+e))^(1/2))*2^(1/2)/f/a^(1/2)

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {4005, 3859, 209, 3880} \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\frac {2 c \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a \sec (e+f x)+a}}\right )}{\sqrt {a} f}-\frac {\sqrt {2} (c-d) \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {2} \sqrt {a \sec (e+f x)+a}}\right )}{\sqrt {a} f} \]

[In]

Int[(c + d*Sec[e + f*x])/Sqrt[a + a*Sec[e + f*x]],x]

[Out]

(2*c*ArcTan[(Sqrt[a]*Tan[e + f*x])/Sqrt[a + a*Sec[e + f*x]]])/(Sqrt[a]*f) - (Sqrt[2]*(c - d)*ArcTan[(Sqrt[a]*T
an[e + f*x])/(Sqrt[2]*Sqrt[a + a*Sec[e + f*x]])])/(Sqrt[a]*f)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3859

Int[Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2*(b/d), Subst[Int[1/(a + x^2), x], x, b*(C
ot[c + d*x]/Sqrt[a + b*Csc[c + d*x]])], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 3880

Int[csc[(e_.) + (f_.)*(x_)]/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2/f, Subst[Int[1/(2
*a + x^2), x], x, b*(Cot[e + f*x]/Sqrt[a + b*Csc[e + f*x]])], x] /; FreeQ[{a, b, e, f}, x] && EqQ[a^2 - b^2, 0
]

Rule 4005

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[c/a,
Int[Sqrt[a + b*Csc[e + f*x]], x], x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/Sqrt[a + b*Csc[e + f*x]], x], x] /
; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {c \int \sqrt {a+a \sec (e+f x)} \, dx}{a}-(c-d) \int \frac {\sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx \\ & = -\frac {(2 c) \text {Subst}\left (\int \frac {1}{a+x^2} \, dx,x,-\frac {a \tan (e+f x)}{\sqrt {a+a \sec (e+f x)}}\right )}{f}+\frac {(2 (c-d)) \text {Subst}\left (\int \frac {1}{2 a+x^2} \, dx,x,-\frac {a \tan (e+f x)}{\sqrt {a+a \sec (e+f x)}}\right )}{f} \\ & = \frac {2 c \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a+a \sec (e+f x)}}\right )}{\sqrt {a} f}-\frac {\sqrt {2} (c-d) \arctan \left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {2} \sqrt {a+a \sec (e+f x)}}\right )}{\sqrt {a} f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.54 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.01 \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\frac {2 \left (\sqrt {2} c \arcsin \left (\sqrt {2} \sin \left (\frac {1}{2} (e+f x)\right )\right )+(-c+d) \arctan \left (\frac {\sin \left (\frac {1}{2} (e+f x)\right )}{\sqrt {\cos (e+f x)}}\right )\right ) \cos \left (\frac {1}{2} (e+f x)\right )}{f \sqrt {\cos (e+f x)} \sqrt {a (1+\sec (e+f x))}} \]

[In]

Integrate[(c + d*Sec[e + f*x])/Sqrt[a + a*Sec[e + f*x]],x]

[Out]

(2*(Sqrt[2]*c*ArcSin[Sqrt[2]*Sin[(e + f*x)/2]] + (-c + d)*ArcTan[Sin[(e + f*x)/2]/Sqrt[Cos[e + f*x]]])*Cos[(e
+ f*x)/2])/(f*Sqrt[Cos[e + f*x]]*Sqrt[a*(1 + Sec[e + f*x])])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(202\) vs. \(2(76)=152\).

Time = 2.40 (sec) , antiderivative size = 203, normalized size of antiderivative = 2.23

method result size
default \(-\frac {\sqrt {-\frac {2 a}{\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1}}\, \sqrt {\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1}\, \left (c \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )+\sqrt {\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1}\right )-d \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )+\sqrt {\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1}\right )-c \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {2}\, \left (-\cot \left (f x +e \right )+\csc \left (f x +e \right )\right )}{\sqrt {\left (1-\cos \left (f x +e \right )\right )^{2} \csc \left (f x +e \right )^{2}-1}}\right )\right )}{f a}\) \(203\)
parts \(\frac {c \sqrt {a \left (\sec \left (f x +e \right )+1\right )}\, \sqrt {-\frac {\cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \left (2 \,\operatorname {arctanh}\left (\frac {\sin \left (f x +e \right )}{\left (\cos \left (f x +e \right )+1\right ) \sqrt {-\frac {\cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}}\right )-\sqrt {2}\, \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )+\sqrt {\cot \left (f x +e \right )^{2}-2 \csc \left (f x +e \right ) \cot \left (f x +e \right )+\csc \left (f x +e \right )^{2}-1}\right )\right )}{f a}+\frac {d \sqrt {-\frac {\cos \left (f x +e \right )}{\cos \left (f x +e \right )+1}}\, \sqrt {a \left (\sec \left (f x +e \right )+1\right )}\, \sqrt {2}\, \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )+\sqrt {\cot \left (f x +e \right )^{2}-2 \csc \left (f x +e \right ) \cot \left (f x +e \right )+\csc \left (f x +e \right )^{2}-1}\right )}{f a}\) \(231\)

[In]

int((c+d*sec(f*x+e))/(a+a*sec(f*x+e))^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/f/a*(-2*a/((1-cos(f*x+e))^2*csc(f*x+e)^2-1))^(1/2)*((1-cos(f*x+e))^2*csc(f*x+e)^2-1)^(1/2)*(c*ln(csc(f*x+e)
-cot(f*x+e)+((1-cos(f*x+e))^2*csc(f*x+e)^2-1)^(1/2))-d*ln(csc(f*x+e)-cot(f*x+e)+((1-cos(f*x+e))^2*csc(f*x+e)^2
-1)^(1/2))-c*2^(1/2)*arctanh(2^(1/2)/((1-cos(f*x+e))^2*csc(f*x+e)^2-1)^(1/2)*(-cot(f*x+e)+csc(f*x+e))))

Fricas [A] (verification not implemented)

none

Time = 0.68 (sec) , antiderivative size = 314, normalized size of antiderivative = 3.45 \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\left [-\frac {\sqrt {2} {\left (a c - a d\right )} \sqrt {-\frac {1}{a}} \log \left (-\frac {2 \, \sqrt {2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \sqrt {-\frac {1}{a}} \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 3 \, \cos \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) + 1}\right ) + 2 \, \sqrt {-a} c \log \left (\frac {2 \, a \cos \left (f x + e\right )^{2} + 2 \, \sqrt {-a} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + a \cos \left (f x + e\right ) - a}{\cos \left (f x + e\right ) + 1}\right )}{2 \, a f}, -\frac {2 \, \sqrt {a} c \arctan \left (\frac {\sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right )}{\sqrt {a} \sin \left (f x + e\right )}\right ) - \frac {\sqrt {2} {\left (a c - a d\right )} \arctan \left (\frac {\sqrt {2} \sqrt {\frac {a \cos \left (f x + e\right ) + a}{\cos \left (f x + e\right )}} \cos \left (f x + e\right )}{\sqrt {a} \sin \left (f x + e\right )}\right )}{\sqrt {a}}}{a f}\right ] \]

[In]

integrate((c+d*sec(f*x+e))/(a+a*sec(f*x+e))^(1/2),x, algorithm="fricas")

[Out]

[-1/2*(sqrt(2)*(a*c - a*d)*sqrt(-1/a)*log(-(2*sqrt(2)*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*sqrt(-1/a)*cos(f
*x + e)*sin(f*x + e) - 3*cos(f*x + e)^2 - 2*cos(f*x + e) + 1)/(cos(f*x + e)^2 + 2*cos(f*x + e) + 1)) + 2*sqrt(
-a)*c*log((2*a*cos(f*x + e)^2 + 2*sqrt(-a)*sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*cos(f*x + e)*sin(f*x + e) +
 a*cos(f*x + e) - a)/(cos(f*x + e) + 1)))/(a*f), -(2*sqrt(a)*c*arctan(sqrt((a*cos(f*x + e) + a)/cos(f*x + e))*
cos(f*x + e)/(sqrt(a)*sin(f*x + e))) - sqrt(2)*(a*c - a*d)*arctan(sqrt(2)*sqrt((a*cos(f*x + e) + a)/cos(f*x +
e))*cos(f*x + e)/(sqrt(a)*sin(f*x + e)))/sqrt(a))/(a*f)]

Sympy [F]

\[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\int \frac {c + d \sec {\left (e + f x \right )}}{\sqrt {a \left (\sec {\left (e + f x \right )} + 1\right )}}\, dx \]

[In]

integrate((c+d*sec(f*x+e))/(a+a*sec(f*x+e))**(1/2),x)

[Out]

Integral((c + d*sec(e + f*x))/sqrt(a*(sec(e + f*x) + 1)), x)

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.60 (sec) , antiderivative size = 699, normalized size of antiderivative = 7.68 \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=-\frac {{\left (\sqrt {2} \sqrt {a} \arctan \left (\frac {{\left ({\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{4} + 16 \, \cos \left (f x + e\right )^{4} + 16 \, \sin \left (f x + e\right )^{4} + 8 \, {\left (\cos \left (f x + e\right )^{2} - \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )} {\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2} - 64 \, \cos \left (f x + e\right )^{3} + 32 \, {\left (\cos \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )} \sin \left (f x + e\right )^{2} + 96 \, \cos \left (f x + e\right )^{2} - 64 \, \cos \left (f x + e\right ) + 16\right )}^{\frac {1}{4}} \sin \left (\frac {1}{2} \, \arctan \left (\frac {8 \, {\left (\cos \left (f x + e\right ) - 1\right )} \sin \left (f x + e\right )}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2}}, \frac {{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2} + 4 \, \cos \left (f x + e\right )^{2} - 4 \, \sin \left (f x + e\right )^{2} - 8 \, \cos \left (f x + e\right ) + 4}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2}}\right )\right ) + 2 \, \sin \left (f x + e\right )}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}}, \frac {{\left ({\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{4} + 16 \, \cos \left (f x + e\right )^{4} + 16 \, \sin \left (f x + e\right )^{4} + 8 \, {\left (\cos \left (f x + e\right )^{2} - \sin \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )} {\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2} - 64 \, \cos \left (f x + e\right )^{3} + 32 \, {\left (\cos \left (f x + e\right )^{2} - 2 \, \cos \left (f x + e\right ) + 1\right )} \sin \left (f x + e\right )^{2} + 96 \, \cos \left (f x + e\right )^{2} - 64 \, \cos \left (f x + e\right ) + 16\right )}^{\frac {1}{4}} \cos \left (\frac {1}{2} \, \arctan \left (\frac {8 \, {\left (\cos \left (f x + e\right ) - 1\right )} \sin \left (f x + e\right )}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2}}, \frac {{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2} + 4 \, \cos \left (f x + e\right )^{2} - 4 \, \sin \left (f x + e\right )^{2} - 8 \, \cos \left (f x + e\right ) + 4}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}^{2}}\right )\right ) + 2 \, \cos \left (f x + e\right ) - 2}{{\left | 2 \, e^{\left (i \, f x + i \, e\right )} + 2 \right |}}\right ) - \sqrt {a} \arctan \left ({\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{4}} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + \sin \left (f x + e\right ), {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{4}} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + \cos \left (f x + e\right )\right )\right )} c}{a f} \]

[In]

integrate((c+d*sec(f*x+e))/(a+a*sec(f*x+e))^(1/2),x, algorithm="maxima")

[Out]

-(sqrt(2)*sqrt(a)*arctan2(((abs(2*e^(I*f*x + I*e) + 2)^4 + 16*cos(f*x + e)^4 + 16*sin(f*x + e)^4 + 8*(cos(f*x
+ e)^2 - sin(f*x + e)^2 - 2*cos(f*x + e) + 1)*abs(2*e^(I*f*x + I*e) + 2)^2 - 64*cos(f*x + e)^3 + 32*(cos(f*x +
 e)^2 - 2*cos(f*x + e) + 1)*sin(f*x + e)^2 + 96*cos(f*x + e)^2 - 64*cos(f*x + e) + 16)^(1/4)*sin(1/2*arctan2(8
*(cos(f*x + e) - 1)*sin(f*x + e)/abs(2*e^(I*f*x + I*e) + 2)^2, (abs(2*e^(I*f*x + I*e) + 2)^2 + 4*cos(f*x + e)^
2 - 4*sin(f*x + e)^2 - 8*cos(f*x + e) + 4)/abs(2*e^(I*f*x + I*e) + 2)^2)) + 2*sin(f*x + e))/abs(2*e^(I*f*x + I
*e) + 2), ((abs(2*e^(I*f*x + I*e) + 2)^4 + 16*cos(f*x + e)^4 + 16*sin(f*x + e)^4 + 8*(cos(f*x + e)^2 - sin(f*x
 + e)^2 - 2*cos(f*x + e) + 1)*abs(2*e^(I*f*x + I*e) + 2)^2 - 64*cos(f*x + e)^3 + 32*(cos(f*x + e)^2 - 2*cos(f*
x + e) + 1)*sin(f*x + e)^2 + 96*cos(f*x + e)^2 - 64*cos(f*x + e) + 16)^(1/4)*cos(1/2*arctan2(8*(cos(f*x + e) -
 1)*sin(f*x + e)/abs(2*e^(I*f*x + I*e) + 2)^2, (abs(2*e^(I*f*x + I*e) + 2)^2 + 4*cos(f*x + e)^2 - 4*sin(f*x +
e)^2 - 8*cos(f*x + e) + 4)/abs(2*e^(I*f*x + I*e) + 2)^2)) + 2*cos(f*x + e) - 2)/abs(2*e^(I*f*x + I*e) + 2)) -
sqrt(a)*arctan2((cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/4)*sin(1/2*arctan2(sin(2
*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + sin(f*x + e), (cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2
*e) + 1)^(1/4)*cos(1/2*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + cos(f*x + e)))*c/(a*f)

Giac [F(-2)]

Exception generated. \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate((c+d*sec(f*x+e))/(a+a*sec(f*x+e))^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:index.cc index_m i_lex_is_greater Error: Bad Argument Value

Mupad [F(-1)]

Timed out. \[ \int \frac {c+d \sec (e+f x)}{\sqrt {a+a \sec (e+f x)}} \, dx=\int \frac {c+\frac {d}{\cos \left (e+f\,x\right )}}{\sqrt {a+\frac {a}{\cos \left (e+f\,x\right )}}} \,d x \]

[In]

int((c + d/cos(e + f*x))/(a + a/cos(e + f*x))^(1/2),x)

[Out]

int((c + d/cos(e + f*x))/(a + a/cos(e + f*x))^(1/2), x)